/*
 * Copyright (C) 2003 BlackClaw, blackclaw@parsoma.net
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include "stdafx.h"
#include "../client/DCPlusPlus.h"
#include "Resource.h"

#include "Advanced3Page.h"
#include "../client/SettingsManager.h"
#include "WinUtil.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

// pothead fix starts #5 svn21
PropPage::TextItem Advanced3Page::texts[] = {
	{ IDC_MISCELLANEOUS, ResourceManager::MISCELLANEOUS },
	{ 0, ResourceManager::SETTINGS_AUTO_AWAY }
};
// pothead fix ends

PropPage::Item Advanced3Page::items[] = {
	{ 0, 0, PropPage::T_END }
};

PropPage::ListItem Advanced3Page::listItems[] = {
	// CDM EXTENSION BEGINS
	{ SettingsManager::DEBUG_COMMANDS, ResourceManager::SETTINGS_DEBUG_COMMANDS },
	{ SettingsManager::DEBUG_DETECTION, ResourceManager::SETTINGS_DEBUG_DETECTION },
	{ SettingsManager::ISP_CHECKING, ResourceManager::SETTINGS_ISP_CHECKING },
	{ SettingsManager::EXTENDED_CHECKING, ResourceManager::GET_O_NICK_USER_RESPONSES },
	{ SettingsManager::EXTENDED_CHECKING2, ResourceManager::GET_R_NICK_USER_RESPONSES },
	{ SettingsManager::CONSIDER_CZDCBCDC_CHEAT, ResourceManager::SETTINGS_CONSIDER_CZDCBCDC_CHEAT },
	{ SettingsManager::CHECK_ALL_CLIENTS_BEFORE_FILELISTS, ResourceManager::SETTINGS_CHECK_ALL_CLIENTS_BEFORE_FILELISTS },
	{ SettingsManager::AUTOMATICALLY_CHECK_HUB_COUNTS, ResourceManager::SETTINGS_AUTO_CHECK_HUB_COUNTS },
	{ SettingsManager::CHECK_SMALL_FILES, ResourceManager::SETTINGS_CHECK_SMALL_FILES },
	{ SettingsManager::DISPLAY_CHEATS_IN_MAIN_CHAT, ResourceManager::SETTINGS_DISPLAY_CHEATS_IN_MAIN_CHAT },
	{ SettingsManager::DELETE_CHECKED_FILELISTS, ResourceManager::SETTINGS_DELETE_CHECKED_FILELISTS },
	{ SettingsManager::CHECK_CONFLICTS, ResourceManager::SETTINGS_CHECK_CONFLICTS },
	{ SettingsManager::MATCH_SHARE_SIZE_FOR_FAKE_HUB_COUNTS, ResourceManager::SETTINGS_MATCH_SHARE_SIZE_FOR_FAKE_HUB_COUNTS },
	{ SettingsManager::MATCH_SHARE_SIZE_FOR_MULTI_HUB_KICK, ResourceManager::SETTINGS_MATCH_SHARE_SIZE_FOR_MULTI_HUB_KICK },
	{ SettingsManager::CHECK_HASH, ResourceManager::SETTINGS_CHECK_HASH },
	// CDM EXTENSION ENDS
	// pothead starts #7 #9 svn21 svn34 svn114 svn119
	{ SettingsManager::SEND_USERIP_ON_CONNECT, ResourceManager::DEFAULT_USERIP_ON_CONNECT },
	{ SettingsManager::USER_SPECIFIC_TIME_OUT, ResourceManager::SETTING_SPECIFIC_TIME_OUT },
	// pothead ends
	//Sulan start svm46 svn109
	//Sulans start svn116
	{ SettingsManager::SEND_CONNECT_TO_ME_AFTER_ADDING_TESTSUR, ResourceManager::SETTINGS_SEND_CONNECT_TO_ME_AFTER_ADDING_TESTSUR},
	//End
	{ SettingsManager::RECHECK_LISTLEN_11B_FAILED_AFTER_FILELIST, ResourceManager::SETTINGS_RECHECK_LISTLEN_11B_AFTER_FILELIST},
	{ SettingsManager::CHECK_MAX_IPS_PER_HUB, ResourceManager::SETTINGS_CHECK_MAX_IPS_PER_HUB },
	{ SettingsManager::CHECK_NICK_SPOOFING, ResourceManager::SETTINGS_CHECK_NICK_SPOOFING },
	{ 0, ResourceManager::SETTINGS_AUTO_AWAY }
};

LRESULT Advanced3Page::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// pothead starts #5 svn21
	PropPage::translate((HWND)(*this), texts);
	// pothead ends

	PropPage::read((HWND)*this, items, listItems, GetDlgItem(IDC_BCDC_OPTIONS));

	// Do specialized reading here
	return TRUE;
}

void Advanced3Page::write()
{
	PropPage::write((HWND)*this, items, listItems, GetDlgItem(IDC_BCDC_OPTIONS));

	// Do specialized writing here
	// settings->set(XX, YY);
}

LRESULT Advanced3Page::onHelpInfo(LPNMHDR /*pnmh*/) {
	HtmlHelp(m_hWnd, WinUtil::getHelpFile().c_str(), HH_HELP_CONTEXT, IDD_ADVANCED3PAGE);
	return 0;
}

/**
 * @file Advanced3Page.cpp
 * $Id: Advanced3Page.cpp 329 2005-08-30 21:06:02Z Pothead $
 */
